package com.zoro.barn.commons.redis.tools;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author zhaoxingwu
 */
@EnableConfigurationProperties(RedisToolProperties.class)
@ComponentScan("com.zoro.barn.barnrediscommon.tools")
public class RedisToolConfigure {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    private final RedisToolProperties redisToolProperties;

    public RedisToolConfigure(RedisToolProperties redisToolProperties) {
        this.redisToolProperties = redisToolProperties;
    }

    @Bean
    public RedisOperation redisOperation() {
        logger.info(" redis operation bean use these properties : {} ", this.redisToolProperties);
        return new RedisOperation(redisToolProperties);
    }
}
